Clap.js
Argument parser for command-line interfaces. It primary target to large tool sets that provides a lot of subcommands. Support for argument coercion and completion makes task run much easer, even if you doesn't use CLI.
Usage
npm install clap
const cli = require('clap');
const myCommand = cli.command('my-command', '[optional-arg]')
.description('Optional description')
.version('1.2.3')
.option('-b, --bool', 'Bollean option')
.option('--foo <foo>', 'Option with required argument')
.option('--bar [bar]', 'Option with optional argument')
.option('--baz [value]', 'Option with optional argument and normalize function', function(value) {
return Number(value);
}, 123)
.action(function(args, literalArgs) {
});
myCommand.run();
myCommand.run(['--foo', '123', '-b'])
myCommand
.command('nested')
.option('-q, --quz', 'Some parameter', 'Default value')
.end()
.command('another-command')
.command('level3-command')
License
MIT